package com.example;

import com.functions.RestrictedUserService;
import com.functions.UserService;
import com.functions.UserServiceImpl;
import com.oop.Updater.ScheduleUpdater;
import com.oop.Updater.Updater;
import com.oop.Viewer.SimpleHttpServer;
import com.oop.config.KafkaConfig;
import com.oop.config.MYSQLConfig;
import com.oop.config.RedisConfig;

/**
 * Hello world!
 *
 */
public class App 
{
    public static void main( String[] args )
    {
        System.out.println( "Hello World!" );

        // testMultipleFunctions();
        testOOP();
    }

    
    public static void testMultipleFunctions() {
        UserServiceImpl impl = new UserServiceImpl();

        UserService service = impl;
        service.register(null, null);

        RestrictedUserService restrictedUserService = impl;
        restrictedUserService.deleteUserByCellphone(null);
    }

    public static void testOOP() {
        {
            Updater redisUpdater = new RedisConfig(null);
            ScheduleUpdater updater = new ScheduleUpdater(redisUpdater, 0, 2);
            updater.start();
        }

        {
            Updater kafkUpdater = new KafkaConfig();
            ScheduleUpdater updater = new ScheduleUpdater(kafkUpdater, 0, 1);
            updater.start();
        }

        {
            SimpleHttpServer server = new SimpleHttpServer(0, 2);
            server.addViewer("/config", new KafkaConfig());
            server.addViewer("/config", new MYSQLConfig());
            server.start();
        }
    }
}
